<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel='stylesheet' type="text/css" href="__PUBLIC__/css/style.css" />
<script type="text/javascript" src="__PUBLIC__/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/jquery.form.min.js"></script>
<script type="text/javascript" src="{:U(GROUP_NAME. '/Public/editor')}"></script>
<script type="text/javascript">
	var data_path = "__DATA__";
	var tpl_public = "__PUBLIC__";
</script>
<script type="text/javascript" src="__PUBLIC__/js/jBox.config.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/calendar.config.js"></script>
<script type="text/javascript" src="__DATA__/static/jq_plugins/iColorPicker/iColorPicker.js"></script>
<script type="text/javascript">
$(function () {
	//缩略图上传
	var litpic_tip = $(".litpic_tip");
	var btn = $(".litpic_btn span");
	$("#fileupload").wrap("<form id='myupload' action='{:U(GROUP_NAME. '/Public/upload', array('tb' => 2))}' method='post' enctype='multipart/form-data'></form>");
    $("#fileupload").change(function(){
    	if($("#fileupload").val() == "") return;
		$("#myupload").ajaxSubmit({
			dataType:  'json',
			beforeSend: function() {
        		$('#litpic_show').empty();
				btn.html("上传中...");
    		},
			success: function(data) {
				//litpic_tip.html("<b>"+data.title+"("+data.size+"k)</b> <span class='delimg' rel='"+data.url+"'>删除</span>");
				if(data.state == 'SUCCESS'){					
					litpic_tip.html(""+ data.title +" 上传成功("+data.size+"k)");
					var img = data.url;//原图
					var timg = data.turl;//缩略图
					$('#litpic_show').html("<img src='"+timg+"' width='120'>");
					$("#litpic").val(timg);
				}else {
					litpic_tip.html(data.state);		
				}			
					btn.html("添加图片");

			},
			error:function(xhr){
				btn.html("上传失败");
				litpic_tip.html(xhr);
			}
		});
	});

	$('#CK_JumpUrl').click(function(){
            var inputs = $(this).parents('dl').find('input');
            if($(this).attr('checked')) {
                $('#JumpUrlDiv').show();

            }else {
                $('#JumpUrlDiv').hide();
            }
            
     });
	
});




$(function () {

	$('#BrowerPicture').click(function(){
		$.jBox("iframe:{:U(GROUP_NAME.'/Public/browseFile', array('stype' => 'picture'))}",{
			title:'XYHCMS',
			width: 650,
   			height: 350,
    		buttons: { '关闭': true }
   			}
		);
	});	

});


function selectPicture(sfile) {
	$("#litpic").val(sfile);
	$.jBox.tip("选择文件成功");
	$.jBox.close(true);
	$('#litpic_show').html("<img src='"+sfile+"' width='120'>");
}


</script>
</head>
<body>
<div class="main">
    <div class="pos">添加文章</div>
	<div class="form">
		<form method='post' id="form_do" name="form_do" action="{:U(GROUP_NAME. '/Article/edit')}">
		<dl>
			<dt> 标题：</dt>
			<dd>
				<input type="text" name="title" class="inp_large" value="{$vo.title}" />
			</dd>
		</dl>
		<dl>
			<dt> 副标题：</dt>
			<dd>
				<input type="text" name="shorttitle" class="inp_w250" value="{$vo.shorttitle}" />
			</dd>
		</dl>		
		<dl>
			<dt> 标题颜色：</dt>
			<dd>
				<input type="text" name="color"  id="color" class="inp_small iColorPicker" value="{$vo.color}" />
			</dd>
		</dl>
		<dl>
			<dt> 自定义属性：</dt>
			<dd>
				<foreach name='flagtypelist' item='v'>
				<label><input type='checkbox' name='flags[]' value='{$key}' <if condition="$key eq B_JUMP">id="CK_JumpUrl"</if> <if condition="($vo.flag & $key) eq $key">checked="checked"</if> /> {$v}</label>&nbsp; 
				</foreach>
			</dd>
		</dl>

		<dl id="JumpUrlDiv" <if condition="($vo.flag & B_JUMP) eq 0">style="display:none;"</if>>
			<dt> 跳转网址：</dt>
			<dd>
				<input type="text" name="jumpurl" class="inp_large" value="{$vo.jumpurl}" />
			</dd>
		</dl>
		<dl>
			<dt> 所属栏目：</dt>
			<dd>
				<select name="cid">
					<foreach name='cate' item='v'>
					<option value="{$v.id}" <if condition="$vo.cid eq $v['id']">selected="selected"</if>>{$v.delimiter}{$v.name}</option>
					</foreach>
				</select>
			</dd>
		</dl>
		<dl>
			<dt> 缩略图：</dt>
			<dd>
				<div class="litpic_show">
				    <div style="float:left;">
				    <input type="text" class="inp_w250" name="litpic" id="litpic"  value="{$vo.litpic}" />
				    <input type="button" class="btn_blue_b" id="BrowerPicture" value="选择站内图片">
				    </div>
						<div class="litpic_btn">
				        <span>添加缩略图</span>
				        <input id="fileupload" type="file" name="mypic">
				    </div>
				    <div class="litpic_tip"></div>
				    <div id="litpic_show">
				    <if condition="$vo['litpic']"><img src="{$vo.litpic}" width='120' /></if>
				    </div>
				</div>
			</dd>
		</dl>
		<dl>
			<dt> 关键词：</dt>
			<dd>
				<input type="text" name="keywords" class="inp_w250" value="{$vo.keywords}" />
			</dd>
		</dl>
		<dl>
			<dt> 摘要：</dt>
			<dd>
				<textarea name="description" id="description" class="tarea_default">{$vo.description}</textarea>
			</dd>
		</dl>	
		<dl>
			<dt> 作者：</dt>
			<dd>
				<input type="text" name="author" class="inp_w250" value="{$vo.author}" /><span class="tip"></span>
			</dd>
		</dl>
		<dl>
			<dt> 来源：</dt>
			<dd>
				<input type="text" name="copyfrom" class="inp_w250" value="{$vo.copyfrom}" /><span class="tip"></span>
			</dd>
		</dl>
		<dl>
			<dt> 内容：</dt>
			<dd>
				<textarea name="content" id="content">{$vo.content}</textarea>
			</dd>
		</dl>
		<dl>
            <dt> 发布时间：</dt>
            <dd>
                
                <input type="text" class="inp_one" name="publishtime" id="publishtime" value="{$vo.publishtime|date='Y-m-d H:i:s',###}">
                <script type="text/javascript">
                    Calendar.setup({
                        weekNumbers: true,
                        inputField : "publishtime",
                        trigger    : "publishtime",
                        dateFormat: "%Y-%m-%d %H:%M:%S",
                        showTime: true,
                        minuteStep: 1,
                        onSelect   : function() {this.hide();}
                    });
                </script>
            </dd>
        </dl>	
		<dl>
			<dt> 评论：</dt>
			<dd>
				<input type="radio" name="commentflag" value="1" <if condition='$vo.commentflag eq 1'>checked="checked"</if> />允许 <input type="radio" name="commentflag" value="0" <if condition='$vo.commentflag eq 0'>checked="checked"</if> />禁止
			</dd>
		</dl>

		<div class="form_b">
			<input type="hidden" name="id" value="{$vo.id}" />
			<input type="hidden" name="pid" value="{$pid}" />
			<input type="submit" class="btn_blue" id="submit" value="提 交">
		</div>
	   </form>
	</div>
</div>

</body>
</html>